﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebSoftSeo.Models;

namespace WebSoftSeo.Areas.Admin.Controllers
{
    public class SupportController : Controller
    {
        private WebSoftSeoEntities db = new WebSoftSeoEntities();
        //
        // GET: /Admin/Support/

        public ActionResult Index()
        {
            return View(db.SupportOnlines.ToList());
        }
        //
        // GET: /Admin/About/Create

        public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /Admin/About/Create

        [HttpPost]
        public ActionResult Create(SupportOnline support)
        {
            if (ModelState.IsValid)
            {
                db.SupportOnlines.Add(support);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(support);
        }

        //
        // GET: /Admin/SupportOnline/Edit
        public ActionResult Edit(int id = 0)
        {
            SupportOnline supportonline = db.SupportOnlines.Find(id);
            if (supportonline == null)
            {
                return HttpNotFound();
            }
            return View(supportonline);
        }

        //
        // POST: /Admin/SupportOnline/Edit/5

        [HttpPost]
        public ActionResult Edit(SupportOnline supportonline)
        {
            if (ModelState.IsValid)
            {
                db.Entry(supportonline).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(supportonline);
        }

        //
        // GET: /Admin/SupportOnline/Delete/5
        public ActionResult Delete(int id = 0)
        {
            SupportOnline supportonline = db.SupportOnlines.Find(id);
            if (supportonline == null)
            {
                return HttpNotFound();
            }
            return View(supportonline);
        }

        //
        // POST: /Admin/SupportOnline/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            SupportOnline supportonline = db.SupportOnlines.Find(id);
            db.SupportOnlines.Remove(supportonline);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }

    }
}
